package kr.hkit.androidcomplete01.ch16;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class Add extends Activity {
	private static String MAINTAG = "Activity Life Cycle";
	private static String SUBTAG = "      child";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Log.i(MAINTAG, SUBTAG + "- on Start()");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch17_add);
		
		Intent intent = getIntent();
		int left = intent.getIntExtra("left", 1);
		int right = intent.getIntExtra("right", 2);
		
		TextView result = (TextView) findViewById(R.id.result);
		result.setText(String.format("%d+%d=%d", left, right, left+right));
		
	}

	@Override
	protected void onStart() {
		Log.i(MAINTAG, SUBTAG + "- onStart()");
		super.onStart();
	}

	@Override
	protected void onRestart() {
		Log.i(MAINTAG, SUBTAG + "-onRestart");
		super.onRestart();
	}

	@Override
	protected void onResume() {
		Log.i(MAINTAG, SUBTAG + "- onResume()");
		super.onResume();
	}

	@Override
	protected void onPause() {
		Log.i(MAINTAG, SUBTAG + "- onPause()");
		super.onPause();
	}

	@Override
	protected void onStop() {
		Log.i(MAINTAG, SUBTAG + "- onStop");
		super.onStop();
	}

	@Override
	protected void onDestroy() {
		Log.i(MAINTAG, SUBTAG + "- onDestroy()");
		super.onDestroy();
	}
	
	
}
